package com.wangshouyu.mp.pay.v3.transactions;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author 王守钰
 * @description 订单金额
 * @date 2020/8/14 9:28
 */
public class RefundAmount implements Serializable {

    /**
     * 退款金额
     * 单位为分
     */
    @SerializedName(value = "refund")
    @JsonProperty(value = "refund")
    @JSONField(name = "refund")
    private Integer refund;

    /**
     * 原订单金额
     * 单位为分
     */
    @SerializedName(value = "total")
    @JsonProperty(value = "total")
    @JSONField(name = "total")
    private Integer total;

    /**
     * 货币类型
     */
    @SerializedName(value = "currency")
    @JsonProperty(value = "currency")
    @JSONField(name = "currency")
    private String currency;

    public Integer getRefund() {
        return refund;
    }

    public void setRefund(Integer refund) {
        this.refund = refund;
    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        RefundAmount that = (RefundAmount) o;
        return Objects.equals(refund, that.refund) && Objects.equals(total, that.total) && Objects.equals(currency, that.currency);
    }

    @Override
    public int hashCode() {
        return Objects.hash(refund, total, currency);
    }

    @Override
    public String toString() {
        return "RefundAmount{" +
                "refund=" + refund +
                ", total=" + total +
                ", currency='" + currency + '\'' +
                '}';
    }
}
